







Algorithms..::SetIntersection<(Of <T>)> Method (IEnumerable<(Of <T>)>, IEnumerable<(Of <T>)>, IEqualityComparer<(Of <T>)>) |
See Also |
![]() ![]() |
[This topic is pre-release documentation and is subject to change in future releases. Blank topics are included as placeholders.]
Computes the set-theoretic intersection of two collections. The intersection of two sets
is all items that appear in both of the sets. If an item appears X times in one set,
and Y times in the other set, the intersection contains the item Minimum(X,Y) times.
The source collections are not changed.
A new collection is created with the intersection of the collections; the order of the
items in this collection is undefined.
Namespace: Wintellect.PowerCollections
Assembly:
PowerCollections (in PowerCollections.dll)
Syntax
C# |
---|
public static IEnumerable<T> SetIntersection<T>( IEnumerable<T> collection1, IEnumerable<T> collection2, IEqualityComparer<T> equalityComparer ) |
Visual Basic (Declaration) |
---|
Public Shared Function SetIntersection(Of T) ( _ collection1 As IEnumerable(Of T), _ collection2 As IEnumerable(Of T), _ equalityComparer As IEqualityComparer(Of T) _ ) As IEnumerable(Of T) |
Visual C++ |
---|
public: generic<typename T> static IEnumerable<T>^ SetIntersection ( IEnumerable<T>^ collection1, IEnumerable<T>^ collection2, IEqualityComparer<T>^ equalityComparer ) |
Parameters
- collection1
- IEnumerable<(Of <T>)>
The first collection to intersect.
- collection2
- IEnumerable<(Of <T>)>
The second collection to intersect.
- equalityComparer
- IEqualityComparer<(Of <T>)>
The IEqualityComparer<T> used to compare items for equality. Only the Equals and GetHashCode member functions of this interface are called.
Return Value
The intersection of the two collections, considered as sets.
Type Parameters
- T
Remarks
When equal items appear in both collections, the returned collection will include an arbitrary choice of one of the two equal items.
If both collections are Set, Bag, OrderedSet, or OrderedBag collections, it is more efficient to use the Intersection or IntersectionWith methods on that class.
Exceptions
Exception | Condition |
---|---|
System..::ArgumentNullException | collection1 or collection2 is null. |
See Also
Algorithms Class
Wintellect.PowerCollections Namespace